package com;

import com.util.GzipUtil;

public class GzipDemo {

    /**
     * 批量数据获取数据解压例子
     * 报文格式如下
     {
     "DOCKING_ORGNO": "DOCKING_ORGNO",
     "COOPER_CODE": "COOPER_CODE",
     "ITEMS": "ITEMS"
     }

     * @param args
     */
    public static void main(String[] args) {
        //服务器中查询到的数据转成json格式
       // String data = "{\"REQSYSID\":\"REQSYSID\",\"PLATID\":\"PLATID\",\"DOCKING_ORGNO\":\"DOCKING_ORGNO\",\"COOPER_CODE\":\"COOPER_CODE\",\"APPLY_NO\":\"APPLY_NO\",\"BANK_NO\":\"BANK_NO\",\"PRD_CODE\":\"PRD_CODE\",\"PROJECT_NO\":\"PROJECT_NO\",\"CUS_NAME\":\"CUS_NAME\",\"CER_TYPE\":\"CER_TYPE\",\"CER_NO\":\"CER_NO\",\"CELLPHONE\":\"CELLPHONE\",\"PERMNT_ADDR_ZIPCODE\":\"PERMNT_ADDR_ZIPCODE\",\"EMPLOYER\":\"EMPLOYER\",\"OFFICE_AREA_CODE\":\"OFFICE_AREA_CODE\",\"OFFICE_NUMBER\":\"OFFICE_NUMBER\",\"OFFICE_ZIPCODE\":\"OFFICE_ZIPCODE\",\"MONTHLY_INCOME\":\"MONTHLY_INCOME\",\"FAMILY_MONTHLY_INCOME\":\"FAMILY_MONTHLY_INCOME\",\"PURCHASE_PRICE\":\"PURCHASE_PRICE\",\"HOUSE_AREA\":\"HOUSE_AREA\",\"LOAN_CURRENCY\":\"LOAN_CURRENCY\",\"DOWN_PAYMENT\":\"DOWN_PAYMENT\",\"LOAN_AMOUNT\":\"LOAN_AMOUNT\",\"LOAN_PERIOD\":\"LOAN_PERIOD\",\"PAYEE\":\"PAYEE\",\"PAYEE_DEBIT_CARD_NO\":\"PAYEE_DEBIT_CARD_NO\",\"REPAYMENT_DEBIT_CARD_NO\":\"REPAYMENT_DEBIT_CARD_NO\",\"COMBINE_LOAN_AMOUNT\":\"COMBINE_LOAN_AMOUNT\",\"COMBINE_LOAN_PERIOD\":\"COMBINE_LOAN_PERIOD\",\"COLLATERAL_ADDR\":\"COLLATERAL_ADDR\",\"MORTGAGE_AREA\":\"MORTGAGE_AREA\",\"PROPERTY_DESC\":\"PROPERTY_DESCRIPTION\",\"REL_NUM\":\"REL_NUM\",\"FILLER1\":\"FILLER1\",\"FILLER2\":\"FILLER2\",\"FILLER3\":\"FILLER3\",\"FILLER4\":\"FILLER4\",\"FILLER5\":\"FILLER5\",\"RELS\":{\"REL\":[{\"REL_TYPE\":\"REL_TYPE\",\"REL_SOCIAL_REL\":\"REL_SOCIAL_REL\",\"REL_NAME\":\"REL_NAME\",\"REL_CERT_TYPE\":\"REL_CERT_TYPE\",\"REL_CERT_NO\":\"REL_CERT_NO\",\"REL_CELLPONE\":\"REL_CELLPONE\",\"REL_ADDR_ZIPCODE\":\"REL_ADDR_ZIPCODE\",\"REL_EMPLOYER\":\"REL_EMPLOYER\",\"REL_OFFICE_AREA_CODE\":\"REL_OFFICE_AREA_CODE\",\"REL_OFFICE_NUMBER\":\"REL_OFFICE_NUMBER\",\"REL_OFFICE_ZIPCODE\":\"REL_OFFICE_ZIPCODE\",\"MON_INCOME\":\"MON_INCOME\",\"FAM_ILYOTSALARY\":\"FAM_ILYOTSALARY\"},{\"REL_TYPE\":\"REL_TYPE\",\"REL_SOCIAL_REL\":\"REL_SOCIAL_REL\",\"REL_NAME\":\"REL_NAME\",\"REL_CERT_TYPE\":\"REL_CERT_TYPE\",\"REL_CERT_NO\":\"REL_CERT_NO\",\"REL_CELLPONE\":\"REL_CELLPONE\",\"REL_ADDR_ZIPCODE\":\"REL_ADDR_ZIPCODE\",\"REL_EMPLOYER\":\"REL_EMPLOYER\",\"REL_OFFICE_AREA_CODE\":\"REL_OFFICE_AREA_CODE\",\"REL_OFFICE_NUMBER\":\"REL_OFFICE_NUMBER\",\"REL_OFFICE_ZIPCODE\":\"REL_OFFICE_ZIPCODE\",\"MON_INCOME\":\"MON_INCOME\",\"FAM_ILYOTSALARY\":\"FAM_ILYOTSALARY\"}]}}";

        //接受到的报文“ITEMS”字段
        String jsonStr = "H4sIAAAAAAAAAO2US5LcIAyG78KaTeax6R2N6W4ygAjgSnlSKQ4y1XePeNrYzgFSlZX1f5KRAKEv4sQPv3g5kctqUmIVC5lVg5IJ+Ic09wjubgAdo6aEA1jhIodJoHerKGHWqiXm37pJyZWZjwKbhXnd1JboZqLwXfBQgjcCs84+GqZzymYixdRhsZk2s9C8QjUSUco+wJTAZmM+4bQJkU2Ti5/StoJOKCVCWwWLcBjQTUrgdpNcROYEa/s5oB5lZn3NC4y6+9cSdoASDSY88ECl4ZBPYQcouTEtUR8CzznufXb8wbyI1mGqtO0RUPKA2Zd9oHcjKFHATOSzc8LwBZ2jTj3000TLFi1MyC20kfVvpmHOzq2qPrwACVPzVYUVs0XkQvO36jiJqwyRM+yi0jYnlGLL1/yH+L95UqfrqzQijvWe0V1sr/+MpliFj004pnKP5biRpPt24c7u/fhHnV8KrhcWLNrz8lhW7aQNEkzetkpdlrdZLGwUqZRw31JrVKuxl85eOnvt7LWzt87eOnvv7L3k9eTylb7k8it/20PtZqnOA5e47Ry4B7X+8uy7WSi+7bBdctUbf73gVTUfjoAyDQZZvLtpcEAlajMOBlm8J2PhFA/RfTwc2RA31nY2KoYxMYyIiLMAgmeKuaUMh4E86f+7+mfu6vfz+Qdal9HD1wcAAA==";
        String unzipStr = GzipUtil.ungzipString(jsonStr);//解压后的数据json字符串
        System.out.println(unzipStr);
    }
}
